# -*- coding: utf-8 -*-
from flask import Blueprint, render_template, g

home = Blueprint('home', __name__)


@home.url_defaults
def add_channel_code(endpoint, values):
    if not values.get('channel_code'):
        values.setdefault('channel_code', g.channel_code)


@home.url_value_preprocessor
def get_profile_owner(endpoint, values):
    g.channel_code = values.pop('channel_code')


@home.route('/')
def index():
    return render_template('home.html')


@home.route('/list')
def game_list():
    return render_template('game_list.html')


@home.route('/found')
def game_found():
    return render_template('found.html')


@home.route('/welfare')
def game_welfare():
    return render_template('welfare.html')


@home.route('/welfare_detail/<string:game_id>')
def game_welfare_detail(game_id):
    return render_template('welfare_detail.html', game_id=game_id)


@home.route('/detail/<string:game_id>')
def game_detail(game_id):
    return render_template('detail.html', game_id=game_id)


@home.route('/search')
def game_search():
    return render_template('search.html')


@home.route('/search_result')
def search_result():
    return render_template('search_result.html')
